<template>
  <div id="app">
    <ul>
      <li v-for="(item,index) in arr" :key="index">
        <span>{{item}}</span>
        <button @click="delBtn(index)">删除</button>
      </li>
    </ul>
    <button @click="addFn">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
    arr: [1, 5, 3],
    }
  },
  mounted:{

  },
  methods:{
    addFn(){
     let num=parseInt(Math.random()*100)
     this.arr.push(num)
    },
    delBtn(i){
    this.arr.splice(i,1)
  }
  },
  
}
</script>

<style>

</style>